from django.http import HttpResponse
from django.template import Context, loader
from django.http import HttpResponse
from django.shortcuts import render_to_response
from news.models import getfeed, getfeeds

ukfeeds = getfeeds(['http://feeds.bbci.co.uk/news/uk/rss.xml', 'http://feeds.reuters.com/reuters/UKdomesticNews'])
#only feed to use AlJazeera - doesn't have specialised RSS
mashup = getfeeds(['http://feeds.bbci.co.uk/news/world/rss.xml', 'http://feeds.reuters.com/reuters/sportsNews', 
			'http://english.aljazeera.net/Services/Rss/?PostingId=2007731105943979989',
			'http://services.digg.com/2.0/story.getTopNews?type=rss']) 
			
sportfeeds = getfeeds(['http://mf.feeds.reuters.com/reuters/UKSportsNews', 'http://feeds.bbci.co.uk/sport/0/rss.xml?edition=uk'])
politicsfeeds = getfeeds(['http://feeds.bbci.co.uk/news/politics/rss.xml?edition=uk'])
technologyfeeds = getfeeds(['http://feeds.bbci.co.uk/news/technology/rss.xml?edition=uk', 'http://mf.feeds.reuters.com/reuters/technologyNews'])
sciencefeeds = getfeeds(['http://mf.feeds.reuters.com/reuters/UKScienceNews', 'http://feeds.bbci.co.uk/news/science_and_environment/rss.xml?edition=uk'])
entertainmentfeeds = getfeeds(['http://mf.feeds.reuters.com/reuters/UKEntertainment', 'http://feeds.bbci.co.uk/news/entertainment_and_arts/rss.xml?edition=uk'])
rowfeeds = getfeeds(['http://feeds.bbci.co.uk/news/world/rss.xml', 'http://mf.feeds.reuters.com/reuters/UKWorldNews'])

def index(request):
    return render_to_response('index.html', mashup)

def sport(request):
    return render_to_response('sport.html', getfeed('http://feeds.reuters.com/reuters/sportsNews'))
        
def politics(request):
    return render_to_response('politics.html', getfeed('http://feeds.reuters.com/reuters/sportsNews'))
    
def technology(request):
    return render_to_response('technology.html', getfeed('http://feeds.reuters.com/reuters/sportsNews'))
    
def science(request):
    return render_to_response('science.html', getfeed('http://feeds.reuters.com/reuters/sportsNews'))

def entertainment(request):
    return render_to_response('entertainment.html', getfeed('http://feeds.reuters.com/reuters/sportsNews'))
    
def uk(request):
    return render_to_response('uk.html', ukfeeds)

def row(request):
    return render_to_response('row.html', getfeed('http://feeds.reuters.com/reuters/sportsNews'))
